/* 
 * File:   solver.h
 * Author: oddi
 *
 * Created on January 26, 2010, 12:12 AM
 */

#ifndef _SOLVER_H
#define	_SOLVER_H

#ifdef	__cplusplus
extern "C" {
#endif
    #include "gsl/gsl_odeiv.h"
    #include "initialize_config.h"
    #include "stdio.h"

    #define SYSTEM_DIMENSION 6
    #define ELEMENT_OF_SOLUTION_XSPEED_VAL 0
    #define ELEMENT_OF_SOLUTION_YSPEED_VAL 1
    #define ELEMENT_OF_SOLUTION_ZSPEED_VAL 2
    #define ELEMENT_OF_SOLUTION_XSPEED_PDF 3
    #define ELEMENT_OF_SOLUTION_YSPEED_PDF 4
    #define ELEMENT_OF_SOLUTION_ZSPEED_PDF 5

    #define ELEMENT_OF_SOLUTION_V_TR_VAL 0
    #define ELEMENT_OF_SOLUTION_V_TR_PDF 1


    typedef struct system_parameters
    {
        gsl_odeiv_system*  ode_system;
        gsl_odeiv_step*    ode_step;
        gsl_odeiv_control* ode_control;
        gsl_odeiv_evolve*  ode_evolve;
        fsp_t* fsp;
        
    }system_paramaters_t;

    /*structure to save solution in specified time and point*/
    typedef struct element_of_solution
    {
        gsl_matrix* stat;
        double t;
        double z0;
        double z;
        int nt;
        int nz;
        int nz0;
        int num_of_rows;
    }element_of_solution_t;


    int solver_initialize_ode_system(system_paramaters_t*, fsp_t*);
    int solver_free_resources_for_ode_system(system_paramaters_t*);
    int solver_get_full_solution(system_paramaters_t*);
    int solver_save_element_of_solution_into_file(char* dir, char* name_template, element_of_solution_t*);
    int solver_read_element_of_solution_from_file(char* file, element_of_solution_t*);
    int solver_free_element_of_solution ( element_of_solution_t* );

    
#ifdef	__cplusplus
}
#endif

#endif	/* _SOLVER_H */

